<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl().'/js/search.js');
?>

<div id="result-search">
    <p class="title-list-pro">Kết quả cho từ khóa <span>" <?php echo $_GET['case']; ?> "</span></p> 
    <?php
    if ($packages == null && $products == null)
        echo "Không tìm thấy kết quả nào phù hợp!";
    ?>
    
    <?php 
    if ($packages != null){
        foreach ($packages as $package){
            echo '<div class=result-row>';
            echo '<p><span class=package-type>Cấu hình</span>  <a class=package href='.Yii::app()->getBaseUrl().'/index.php?r=shop/shop/package/id/'.$package->id.' id=package-'.$package->id.' rel='.$package->id.' type=1>'.$package->name.'</a></p>';
            echo '<div>'.Product::limitDesc($package->desc,150).'</div>';
            echo '<div id=detail-'.$package->id.'></div>';
            echo '</div>';
        }
    }
    ?>
    
    <?php
    if ($products != null){
        foreach ($products as $product){
            echo '<div class=result-row>';
            echo '<p><span class=product-type>Sản phẩm</span> <a href='.Yii::app()->getBaseUrl().'?r=shop/products/view&id='.$product->id.'>'.$product->name.'</a></p>';
            echo '<div>'.Product::limitDesc($product->description,150).'</div>';
            echo '</div>';
        }
    }
    ?>
    <div id="distributor"></div>
</div>
